describe("MoveTransactionDetailsController in SG", function() {

    var controller = null;
    var transaction = null;
    var objE = null;

    beforeEach(function() {
    	transaction = App.BaseTransaction.create();
        objE = new BreezeException({
            errorCode: 123,
            errorMessage: 'error'
        });

        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        App.MoveTransactionDetailsController.reopen({

            init: function() {
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);

            }

        });

        controller = App.MoveTransactionDetailsController.create();
    });

    describe("prepareController method", function() {

        it("prepareController should invoke", function() {
            spyOn(App.Router, 'getParameter').andReturn(transaction);
            spyOn(controller, 'showLoading');
            spyOn(App.api_paymentHistoryDetail, 'getPaymentHistoryDetails');

            controller.prepareController();

            expect(controller.get('transaction')).toBe(null);
            expect(App.Router.getParameter).toHaveBeenCalled();
            expect(controller.showLoading).toHaveBeenCalled();
            expect(App.api_paymentHistoryDetail.getPaymentHistoryDetails);
        });

    });
    
    xdescribe("callback method", function() {

        it("callback success", function() {
        	spyOn(controller, 'hideLoading');

            controller.callback(transaction, null);

            expect(controller.get('transaction')).toBe(transaction);
            expect(controller.hideLoading).toHaveBeenCalled();
        });

        it("callback error", function() {
        	spyOn(controller, 'hideLoading');

            controller.callback(null, objE);

            expect(controller.get('transaction')).toBe(null);
            expect(controller.hideLoading).toHaveBeenCalled();
        });
        
    });

});